<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<button>删除div</button>
		<div>第1个div</div>
		<div>第2个div</div>
		<div>第3个div</div>
		<div>第4个div</div>
		<div>第5个div</div>
		<div>第6个div</div>
		<div>第7个div</div>
		<div>第8个div</div>
		<div>第9个div</div>
		<div>第10个div</div>
		
		<script>
			document.getElementsByTagName("button")[0].onclick = function(){
				var num = prompt("请输入你要删除的div的编号：");
				var ele = document.getElementsByTagName("div")[num-1];
				ele.parentNode.removeChild(ele);
			}
		</script>
	</body>
</html>
